<?php 
$setting_page = $this->common_model->getone('setting',array('id'=>1));
if(!empty($title)){ 
    $page_title = $title; 
}
else{
    $page_title = $setting_page->title;
}
if(!empty($metades)){ 
    $page_des = $metades; 
}
else{
    $page_des = $setting_page->metades;
}
if(!empty($metakey)){ 
    $page_key = $metakey; 
}
else{
    $page_key = $setting_page->metakey;
}
// Menu Type giáo viên
$idss=$this->session->userdata('id');
$count_email_chua_doc = 0;
if($idss){
	$accdn=$this->common_model->getone('users',array('id'=>$idss));
	$data_email = $this->common_model->getdata('email',array('email_to'=>$accdn->email,'status'=>0,'publish'=>1));
	if($data_email){
		$count_email_chua_doc = count($data_email);
	}
}
$monhoc = $this->common_model->getdata('subjects',array('publish'=>1),array('id','title'),array('order','ASC'));
$data_lop = $this->common_model->getdata('request',array('publish'=>1));
if(!$data_lop){
	$count_lop_can_gia_su = 0;
}
else{
	$count_lop_can_gia_su = count($data_lop);
}
?>
<!DOCTYPE html>
<html>
   <head>
      <meta http-equiv="content-type" content="text/html;charset=UTF-8"/>
      <meta name="description" content="<?php echo $page_des; ?>"/>
      <meta name="keywords" content="<?php echo $page_key; ?>" />
      <meta name="viewport" content="width=device-width, initial-scale=1.0"/>
      <link href="http://fonts.googleapis.com/css?family=Roboto+Condensed:400,700" rel="stylesheet" type="text/css"/>
      <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>skin/front-end/css/reset.css" media="screen"/>
      <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>skin/front-end/css/style.css" media="screen"/>
      <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>skin/front-end/css/register.css" media="screen"/>
      <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>skin/front-end/css/todo_style.css" media="screen" />
      <!-- FONT -->
	   <link href='http://fonts.googleapis.com/css?family=Open+Sans:400,700,300,600&subset=latin,vietnamese' rel='stylesheet' type='text/css' />
      <!-- /FONT -->
      <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>skin/front-end/css/font-awesome.min.css" media="screen"/>
      <title><?php echo $page_title; ?></title>
      <script src="<?php echo base_url() ?>skin/front-end/js/jquery-1.10.2.min.js"></script>
      <!-- JQUERY CROP -->
      <script src="<?php echo base_url() ?>skin/front-end/js/jquery.color.js"></script>  
      <script src="<?php echo base_url() ?>skin/front-end/js/jquery.Jcrop.min.js"></script> 
      <script src="<?php echo base_url() ?>skin/front-end/js/jquery.leanModal.min.js"></script> 
      <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>skin/front-end/css/jquery.Jcrop.min.css" media="screen" />
      <!-- JQUERY UI -->
      <script src="<?php echo base_url() ?>skin/front-end/js/jquery-ui-1.9.2.custom.min.js"></script>
      <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>skin/front-end/css/ui-lightness/jquery-ui-1.9.2.custom.min.css" media="screen" />
      <!-- JQUERY UI -->
      <!--[if lt IE 9]>
      <script src="http://html5shim.googlecode.com/svn/trunk/html5.js"></script>
      <script src="http://css3-mediaqueries-js.googlecode.com/svn/trunk/css3-mediaqueries.js"></script>
      <link rel="stylesheet" type="text/css" href="<?php echo base_url() ?>skin/front-end/css/font-awesome-ie7.min.css" media="screen">
      <![endif]-->
      <script>
        
         $(document).ready(function(){
			$('body').append('<div id="top"><i class="icon-circle-arrow-up icon-4x" style="color:#ff9900;"></i></div>');
			$('#top').hide();
			$('#top').click(function() {
			$('html, body').animate({scrollTop:0},500);
			});
		});
      </script>
      <script>
        $(document).ready(function(){
			$('.gopy').click(function(){
                $('body').prepend('<div class="overlay">&nbsp;</div>')
                $('#contact-pp').fadeIn(400);
			});
			$('div.overlay').click(function(){
                $('#contact-pp').slideUp(400);
                $('.overlay').remove();
			});
			$('.close1,.close-over').click(function(){
                $('#contact-pp').slideUp(400);
                $('.overlay').remove();
			});

			$("a[rel*=leanModal]").leanModal();		

			$('#login_form').click(function(){
				$('#register').attr( "style", "display: none;" );
			});
			
			$('#login_form2').click(function(){
				$('#register').attr( "style", "display: none;" );
			});
			
			$('#register_form').click(function(){
				$('#login').attr( "style", "display: none;" );
			});
			
			$('ul#dd_diem_thuong').mouseleave(function(){
				var drop_down_rel = $("ul#dd_diem_thuong").attr("rel");
				$('#'+drop_down_rel).removeClass("open");
			});
			
			$('ul#dd_diem_thuong').mouseenter(function(){
				var drop_down_rel = $("ul#dd_diem_thuong").attr("rel");
				$('#'+drop_down_rel).addClass("open");
			});
			
			$('ul#dd_cong_viec_gia_su').mouseleave(function(){
				var drop_down_rel = $("ul#dd_cong_viec_gia_su").attr("rel");
				$('#'+drop_down_rel).removeClass("open");
			});
			
			$('ul#dd_cong_viec_gia_su').mouseenter(function(){
				var drop_down_rel = $("ul#dd_cong_viec_gia_su").attr("rel");
				$('#'+drop_down_rel).addClass("open");
			});
			
			$('ul#dd_quan_ly_ho_so').mouseleave(function(){
				var drop_down_rel = $("ul#dd_quan_ly_ho_so").attr("rel");
				$('#'+drop_down_rel).removeClass("open");
			});
			
			$('ul#dd_quan_ly_ho_so').mouseenter(function(){
				var drop_down_rel = $("ul#dd_quan_ly_ho_so").attr("rel");
				$('#'+drop_down_rel).addClass("open");
			});
			
			$('#create-account').on('click',function(){
				$("#sign-up-loading").html('<center>Đang tải dữ liệu, vui lòng chờ giây lát...</center>');
				$('#name-error').addClass("hidden-content");
				$('#name-error').html('');
				$('#email-error').addClass("hidden-content");
				$('#email-error').html('');
				$('#password-error').addClass("hidden-content");
				$('#password-error').html('');
				$("#sign-up-form").submit(function(e){
					var regData = $(this).serializeArray();
					var regURL = $(this).attr("action");
					$.ajax({
						url : regURL,
						type: "POST",
						data : regData,
						success:function(data, textStatus, jqXHR){
							if(!data.success){
								$('#'+data.error+'-error').removeClass("hidden-content");
								$('#'+data.error+'-error').append(data.content);
								$("#sign-up-loading").html('');
							}
							else{
								window.location.href = data.redirect;
							}
						}
					});
					e.preventDefault(); //STOP default action
					e.unbind(); //unbind. to stop multiple form submit.
				});
			});
			
			$('#login-account').on('click',function(){
				$("#login-form").submit(function(e){
					var logData = $(this).serializeArray();
					var logURL = $(this).attr("action");
					$.ajax({
						url : logURL,
						type: "POST",
						data : logData,
						success:function(data, textStatus, jqXHR){
							if(!data.success){
								$('.form-errors').removeClass("hidden-content");
								$('.form-errors').append(data.content);
							}
							else{
								window.location.href = data.redirect;
							}
						}
					});
					e.preventDefault(); //STOP default action
					e.unbind(); //unbind. to stop multiple form submit.
				});
			});

			var availableTags = [<?php  if(!empty($monhoc)){
				$i=0;
				$n=count($monhoc);
				foreach($monhoc as $mon){
					if($i==$n){
						echo '"'.$mon->title.'"';
					}else{
						echo '"'.$mon->title.'",';
					}
					$i++;
				}
			}?>];
			$( "#header-search" ).autocomplete({
			  source: availableTags,disabled: false,autoFocus:true,widget:true,delay:0
			});
        });
	</script>
    <script>
        $(document).ready(function(){
            $('.loading').hide();
            
           $('#send').on('click',function(){
                $("#send").replaceWith('<i class="icon-spinner icon-spin icon-2x" style="color: yellow;"></i><br /><span style="color: yellow;">Sending...</span>');
                var email=$('input.email').val();
                var phone=$('input.phone').val();
                var content=$('textarea.content').val();
                
                $.ajax({
                   type:"POST",
                   url:'<?php echo base_url().'gop-y-10cong.html';?>',
                   data: {email:email,phone:phone,content:content},
                   success:succcc
                });
                return false;
           });
        });
        function succcc(data, status){
            $('#form-contact').html(data);          
        }
        
    </script>
   </head>
	<body>
    <a id="la_askus_btn" accesskey="1" href="#" class="gopy"></a>
    <div class="lean_overlay overlay hidden">&nbsp;</div>
    <div id="contact-pp" style="display:none;"> 
            <div id="form-contact">     
                <h4>Đóng góp ý kiến</h4>
                <p class="thongbao">Cảm ơn đã quân tâm đến 10 + mọi ý kiến đóng góp của bạn sẽ góp phần giúp cho 10 + ngày càng hoàn thiện hơn </p>
                <form>
                <p><label class="label">Email: </label><input type="text" name="email" class="email" value="" /></p>
                <p><label class="label">Số điện thoại: </label><input type="text" name="phone" class="phone" value="" /></p>
                <p><label class="label">Nội dung: </label><textarea name="content" class="content"></textarea></p>
                <p class="sbm"><input id="send" class="submit" type="button" value="GỬI" /></p>
                </form> 
            </div>
            <div title="close" class="close1"></div>
    </div>
	<!--đăng ký-->
	<div id="register" style="display:none" class="signup-module section">
		<div id="signup-container" class="signup-webform-modal modal hide fade new-modal in" style="display: block;">
			<div id="webform-signup" class="signup-option signup-webform">
				<form id="sign-up-form" name="sign-up-form" action="<?php echo base_url();?>dang-ky.html" method="POST">
					<input type="hidden" name="quickregister" value="1">
					<h2>Tham gia 10+</h2>
					<div class="form-group-user-role form-row">
						<label class="primary1" style="cursor: text;">Bạn là...</label>
						<label class="radio-btn-pair">
							<input type="radio" name="type" value="0" class="form-control" /> Học sinh
						</label> 
						<label class="radio-btn-pair">
							<input type="radio" name="type" value="1" class="form-control" checked> Gia sư
						</label>
					</div>
					<div class="form-row">
						<input type="text" class="text_dialog" name="name" placeholder="Họ và tên của bạn" maxlength="60" style="height:40px;padding:0px 5px;">
						<h4 id="name-error" class="error email-form-error left subsection hidden-content" style="width:90%">
						</h4>
					</div>
					<div class="form-row">
						<input type="text" class="text_dialog" name="email" placeholder="Hòm thư điện tử" maxlength="60" style="height:40px;padding:0px 5px;">
						<h4 id="email-error" class="error email-form-error left subsection hidden-content" style="width:90%">
						</h4>
					</div>
					<div class="form-row">
						<input type="password" class="text_dialog" name="password" placeholder="Mật khẩu" maxlength="60" style="height:40px;padding:0px 5px;">
						<h4 id="password-error" class="error email-form-error left subsection hidden-content" style="width:90%">
						</h4>
					</div>
					<input type="submit" id="create-account" class="btn-register" value="Tạo tài khoản">
				</form>
			</div>
			<div id="sign-up-loading">
			</div>
			<footer id="pivot-login" class="clearfix">
				<h3>Bạn đã có tài khoản? <a id="login_form2" rel="leanModal" href="#login" title="Đăng nhập vào tài khoản!">Đăng nhập »</a></h3>
			</footer>
		</div>
	</div>
	<!--đăng ký-->
	<!--đăng nhập-->
	<div id="login" style="display:none" class="signup-module section">
		<div id="signup-container" class="signup-webform-modal modal hide fade new-modal in" style="display: block;">
			<div id="webform-signup" class="signup-option signup-webform">
				<form id="login-form" name="login-form" action="<?php echo base_url();?>dang-nhap.html" method="POST">
					<input type="hidden" name="quicklogin" value="1">
					<h2>Đăng nhập 10+</h2>
					<div class="form-row">
						<input type="text" class="text_dialog" name="username" placeholder="Hòm thư điện tử" maxlength="60" style="height:40px;padding:0px 5px;">
					</div>
					<div class="form-row">
						<input type="password" class="text_dialog" name="password" placeholder="Mật khẩu" maxlength="60" style="height:40px;padding:0px 5px;">
					</div>
					<input type="submit" id="login-account" class="btn-login" value="Đăng nhập">
					<div class="form-errors error hidden-content" style="width:90%"></div>
				</form>
			</div>
			<footer id="pivot-login" class="clearfix">
				<h3><a href="<?php echo base_url();?>reset-password.html" title="Quên tài khoản hoặc mật khẩu!">Quên tài khoản hoặc mật khẩu »</a></h3>
			</footer>
		</div>
	</div>
	<!--đăng nhập-->
<header id="header" class="clearfix">
<?php 
$url = base_url();
if(!empty($accdn)){
	if($accdn->type != 0){
		$url .= 'gia-su.html';
	}
}
?>
	<a id="logo-link" href="<?php echo $url; ?>">
		<img id="new-logo" src="<?php echo base_url() ?>skin/front-end/images/logo.png" data-src2x="<?php echo base_url() ?>skin/front-end/images/logo.png" width="60" height="16">
	</a>
<?php
if(!empty($accdn)){
	if($accdn->type == 0){
?>
	<div id="header-search-container" class="form-control textf-icon tfic-search ui-front clearfix1">
		<form action="<?php echo base_url().'tim-kiem.html'; ?>" method="POST">
			<input name="search" type="text" id="header-search" placeholder="Bạn cần tìm gia sư môn học gì?" value="" class="ui-autocomplete-input" autocomplete="off">
		</form>
	</div>
<?php
	}
} else {
?>
	<div id="header-search-container" class="form-control textf-icon tfic-search ui-front clearfix1">
		<form action="<?php echo base_url().'tim-kiem.html'; ?>" method="POST">
			<input name="search" type="text" id="header-search" placeholder="Bạn cần tìm gia sư môn học gì?" value="" class="ui-autocomplete-input" autocomplete="off">
		</form>
	</div>
<?php
}
?>
	<div id="header-right-container" class="clearfix1">
	<?php if($this->session->userdata('email')){ ?>
		<ul id="account-btn-container" class="btn-group">
			<li class="dropdown">
				<a href="#" id="account-btn" class="btn dropdown-toggle" data-toggle="dropdown">
					<i class="down-arrow"></i>
					<span class="user-name-abbr"><?php echo $accdn->name; ?></span>
				</a>
				<ul id="account-dropdown" class="dropdown-menu">
				<?php if(!empty($accdn)) {?>
					<li><a title="Thay đổi mật khẩu" href="<?php echo base_url().'tai-khoan/doi-mat-khau.html'; ?>">Thay đổi mật khẩu</a></li>
					<li><a title="Thay đổi thông tin" href="<?php echo base_url().'tai-khoan/thong-tin.html'; ?>">Thông tin tài khoản</a></li>
				<?php if($accdn->type == 0){?>
					<li><a title="Giáo viên của tôi" href="<?php echo base_url().'tai-khoan/giao-vien.html';  ?>">Giáo viên của tôi</a></li>
					<li><a title="Tìm gia sư" href="<?php echo base_url().'tim-gia-su.html' ?>">Tìm gia sư</a></li>
					<li><a title="Yêu cầu gia sư" href="<?php echo base_url().'yeu-cau-gia-su.html' ?>">Yêu cầu gia sư</a></li>
					<li><a title="Mời bạn bè" href="<?php echo base_url().'moi-ban-be.html'; ?>">Mời bạn bè</a></li>
					<li><a title="Trợ giúp" href="<?php echo base_url().'tro-giup.html' ?>">Trợ giúp</a></li>
					<li><a title="Ý kiến người dùng" href="<?php echo base_url().'y-kien.html' ?>">Ý kiến người dùng</a></li>
					<li><a title="Thư viện" href="javascript://" onclick="alert('Chức năng đã được xây dựng!')">Thư viện</a></li>
				<?php } ?>
					<li><a title="Thoát" href="<?php echo base_url().'logout.html' ?>">Thoát</a></li>
				<?php } ?>
				</ul>
			</li>
		</ul>
		<div id="notifications">
			<span class="notification-icon user-content messages" style="cursor:pointer;" onclick="location.href='<?php echo base_url().'gia-su/email.html';  ?>'">
				<i class="nav-icon"></i>
				<span class="new badge" <?php if($count_email_chua_doc == 0) echo 'style="display:none;"';?>><?php echo $count_email_chua_doc;?></span>
			</span>
			<?php 
			if(!empty($accdn)) { 
				if($accdn->type != 0){
			?>
			<span class="notification-icon user-content scheduled-lessons" style="cursor:pointer;" onclick="location.href='<?php echo base_url().'gia-su/lop-can-gia-su.html'; ?>'">
				<i class="nav-icon"></i>
				<span class="new badge" <?php if($count_lop_can_gia_su == 0) echo 'style="display:none;"';?>><?php echo $count_lop_can_gia_su;?></span>
			</span>
			<?php 
				}
			}
			?>
		</div>
		<?php 
			if(!empty($accdn)) { 
				if($accdn->type != 0){
		?>
		<span class="vbar"></span>
		<ul>
		<?php $this->load->view('mod_menu/menu_giasu_new'); ?>
		</ul>
		<?php 
				}
			}
		}
		else{
	?>
		<a class="header-right nav-btn" rel="leanModal" id="register_form" href="#register">ĐĂNG KÝ</a>
		<a class="header-right nav-btn" rel="leanModal" id="login_form" href="#login">ĐĂNG NHẬP</a>
		<a class="header-right nav-btn" href="<?php echo base_url().'gia-su/lop-can-gia-su.html'; ?>"><span class="badge" <?php if($count_lop_can_gia_su == 0) echo 'style="display:none;"';?>><?php echo $count_lop_can_gia_su;?></span> LỚP CẦN GIA SƯ</a>
	<?php }  ?>
	</div>
	<div id="popup">
		<a id="popup-close" href="#"></a>
		<div id="popup-content"></div>
	</div>
</header>	
<!-- /#header -->
<article id="container" style="margin-top: 53px">
<?php if(!empty($content)) {echo $content;} ?>
</article>
<!-- /#container -->
    <?php $this->load->controller('mod_footer/mod_footer/index'); ?>
    <!-- Sosical -->
    <div id="fb-root"></div>
            <script>(function(d, s, id) {
              var js, fjs = d.getElementsByTagName(s)[0];
              if (d.getElementById(id)) return;
              js = d.createElement(s); js.id = id;
              js.src = "//connect.facebook.net/vi_VN/all.js#xfbml=1";
              fjs.parentNode.insertBefore(js, fjs);
            }(document, 'script', 'facebook-jssdk'));</script>
<script type="text/javascript" src="https://apis.google.com/js/plusone.js"></script>
    </body>
</html>